//
//  JGSectionViewCell.m
//  JGExpandTableDemo2
//
//  Created by mac on 15/9/21.
//  Copyright (c) 2015年 Free. All rights reserved.
//

#import "JGDrupSectionViewCell.h"

@interface JGDrupSectionViewCell ()
{
    UIImageView  *_arrowImageView;
}

@end

@implementation JGDrupSectionViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleGray;
        self.textLabel.backgroundColor = [UIColor clearColor];
        self.textLabel.font = [UIFont systemFontOfSize:15.0f];
        
        //标题
        _titleLabel = [JGHelper commonLabelWithFrame:CGRectMake(65, 25, 200, 20) font:[UIFont systemFontOfSize:15.0f] textColor:[UIColor blackColor] lineBreakMode:NSLineBreakByTruncatingTail];
        [self.contentView addSubview:_titleLabel];
        
        //下分割线
        UIImageView *line = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"gen_line"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)]];
        line.top = 69;
        line.width = self.width;
        [self.contentView addSubview:line];
        
        //展开时的指示剪头
        _arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"drug_sort_bg_arrow.png"]];
        _arrowImageView.top = 65;
        _arrowImageView.left = 31;
        [self.contentView addSubview:_arrowImageView];
        _arrowImageView.hidden = YES;
        
        //内容图片
        _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 15, 45, 45)];
        [self.contentView addSubview:_iconImageView];
        _iconImageView.layer.cornerRadius = 3.0f;
        _iconImageView.clipsToBounds = YES;
        
        //红点提示
        _redDot = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"gen_notification"]];
        _redDot.left = 50;
        _redDot.top = 12;
        _redDot.hidden = YES;
        [self.contentView addSubview:_redDot];
    }
    
    return self;
}


-(void)setIsOpen:(BOOL)isOpen
{
    _isOpen = isOpen;
    _arrowImageView.hidden = !isOpen; //打开就显示
}
@end
